use super::solution::Solution;


impl Solution {
    pub fn find_winning_player(skills: Vec<i32>, k: i32) -> i32 {
        let mut m =skills[0];
        let mut mi=0;
        let mut beat_num=0;
        for (index,skill) in skills.into_iter().enumerate().skip(1) {
            if skill>m{
                mi=index;
                m=skill;
                beat_num=0;
            }
            beat_num+=1;
            if beat_num==k{
                return mi as i32;
            }
        };
        mi as i32
    }
}